<template>
  <div>
    <el-form ref="form" :model="role" label-width="100px" size="normal">
      <el-form-item label="角色名称">
        <el-input v-model="role.roleName" />
      </el-form-item>
      <el-form-item label="角色编码">
        <el-input v-model="role.roleCode" />
      </el-form-item>
      <el-form-item label="备注">
        <el-input v-model="role.remark" />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" size="normal" @click="onSubmit">提交</el-button>
        <el-button size="normal" @click="onCancel">取消</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import { updateById } from '@/api/role'

export default {
  components: {
    // Tinymce
  },
  props: {
    role: {
      id: null,
      roleName: null,
      roleCode: null,
      remark: null,
      isDeleted: null
    }
  },
  data() {
    return {
    }
  },
  methods: {
    onSubmit() {
      updateById(this.role).then(res => {
        this.$message.success(res.message)
        this.$emit('fetchData')
        this.$emit('closeUpdateDialog')
      })
    },
    onCancel() {
      this.$emit('closeUpdateDialog')
    }
  }
}
</script>
